<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="HandheldFriendly" content="True">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>SDC</title>
<link rel="stylesheet" type="text/css" media="all" href="css/reset.css" />
<link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script src="js/canvas-particle.js" type="text/javascript"></script>
<script src="js/echarts.min.js" type="text/javascript"></script>
<script src="js/js.js" type="text/javascript"></script>
<script src="js/layui.all.js"></script>
</head>
<style type="text/css">
	body{background:#18254d;}
	#mydiv{z-index: 2;}
	.dia_log .dia_trlink{height:.88rem;line-height:.88rem;border:none;background:none;}
</style>
<body>
	<!-- 背景div -->
	<div id="mydiv"></div>
	
	<!-- 头部 -->
	<div class="header">
		<h1 class="hetitle">交易大厅</h1>
	</div>
	
	<div id="page" class="page m3">
		<div id="main2" class="initem"></div>

		<div class="tran_top">
			<p class="trantop_t">实时价格：<span class="trantoptd_ts" id="price">0.0000</span> $</p>
			<div class="trantop_con">
				<p class="trantop_ct1">买入数量</p>
				<div class="trantop_list">
					<!-- <a href="javascript:;" class="trantop_link on">3</a>
					<a href="javascript:;" class="trantop_link">5</a>
					<a href="javascript:;" class="trantop_link">10</a>
					<a href="javascript:;" class="trantop_link">20</a>
					<a href="javascript:;" class="trantop_link">50</a>
					<a href="javascript:;" class="trantop_link">100</a> -->
				</div>
			</div>
			<p class="trantop_t">合计价格：<span class="trantoptd_ts" id="price2">0.0000</span> $<a href="javascript:;" class="trantop_tlink">申请购买</a></p>
		</div>
		<div class="tran_lind">
			<a href="view/order.html" class="tran_link">我的订单</a>
		</div>
		<div class="tran_bot">
			<p class="tranbot_title">交易大厅</p>
			<table class="tranbot_table">
				<thead>
					<tr>
						<th>数量/个</th>
						<th>单价/USD</th>
						<th>总价/USD</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<!-- <tr>
						<td>20</td>
						<td>80</td>
						<td>1600</td>
						<td><a href="javascript:;" class="tranbot_link">卖给他</a></td>
					</tr>
					<tr>
						<td>20</td>
						<td>80</td>
						<td>1600</td>
						<td><a href="javascript:;" class="tranbot_link">卖给他</a></td>
					</tr>
					<tr>
						<td>20</td>
						<td>80</td>
						<td>1600</td>
						<td><a href="javascript:;" class="tranbot_link">卖给他</a></td>
					</tr>
					<tr>
						<td>20</td>
						<td>80</td>
						<td>1600</td>
						<td><a href="javascript:;" class="tranbot_link">卖给他</a></td>
					</tr>
					<tr>
						<td>20</td>
						<td>80</td>
						<td>1600</td>
						<td><a href="javascript:;" class="tranbot_link">卖给他</a></td>
					</tr> -->
				</tbody>
			</table>
		</div>
	</div>
	<!-- footer -->
	<div class="footer">
		<div class="fonav">
			<a href="index.html" class="foitem">
				<img src="images/foimg1.png" alt="" class="foimg" />首页
			</a>
			<a href="shopping.html" class="foitem">
				<img src="images/foimg2.png" alt="" class="foimg" />矿机
			</a>
			<a href="transaction.html" class="foitem on">
				<img src="images/foimg3_on.png" alt="" class="foimg" />交易
			</a>
			<a href="my.html" class="foitem">
				<img src="images/foimg4.png" alt="" class="foimg" />我的
			</a>
		</div>
	</div>
<!--遮罩-->
<div class="mask"></div>
<!--申请购买-->
<div class="dialog" id="d1">
	<div class="dialog_content">
		<div class="dia_log">
			<h1 class="dia_title">申请购买</h1>
			<div class="dia_tran">
				<p class="dia_tranp">购买数量<span class="dia_tranps" id="number">3</span></p>
				<p class="dia_tranp">购买单价<span class="dia_tranps" id="dia_price1">0.0000 USD</span></p>
				<p class="dia_tranp">合计价格<span class="dia_tranps" id="dia_price2">0.0000 USD</span></p>
			</div>
			<div class="pwd-box">
			    <input type="tel" maxlength="6" class="pwd-input" id="pwd-input1">
			    <div class="fake-box fake-box1">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			    </div>
			</div>
			<div class="dia_trabot">
				<a href="javascript:closen();" class="dia_trlink">取消</a>
				<button href="javascript:;" class="dia_trlink" id="dialog1">确定申请</button>
			</div>
		</div>
	</div>
</div>

<!--卖给他弹窗-->
<div class="dialog" id="d2">
	<div class="dialog_content">
		<div class="dia_log">
			<p class="dia_trat1">是否确认进行交易</p>
			<p class="dia_trat2" id="dia_trat2">确认将出售600SDC余额</p>
			<div class="dia_trabot">
				<a href="javascript:closen();" class="dia_trlink">取消</a>
				<a href="javascript:dialog('#d3');" class="dia_trlink">确定并处理</a>
			</div>
		</div>
	</div>
</div>

<!--卖给他密码弹窗-->
<div class="dialog" id="d3">
	<div class="dialog_content">
		<div class="dia_log">
			<h1 class="dia_title">申请出售</h1>
			<div class="dia_tran">
				<p class="dia_tranp">数量/个<span class="dia_tranps" id="shen_number">3</span></p>
				<p class="dia_tranp">单价/USD<span class="dia_tranps" id="shen_price1">0.0000 USD</span></p>
				<p class="dia_tranp">总价/USD<span class="dia_tranps" id="shen_price2">0.0000 USD</span></p>
				<input type="hidden" id="hidden">
			</div>
			<div class="pwd-box">
			    <input type="tel" maxlength="6" class="pwd-input" id="pwd-input2">
			    <div class="fake-box fake-box2">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			        <input type="password" readonly="">
			    </div>
			</div>
			<div class="dia_trabot">
				<a href="javascript:closen();" class="dia_trlink">取消</a>
				<button href="javascript:;" class="dia_trlink" id="dialog2">确定申请</button>
			</div>
		</div>
	</div>
</div>
	<script src="js/transaction.js"></script>
</body>
<script type="text/javascript">
//申请购买密码输入框
var $input1 = $(".fake-box1 input");  
$("#pwd-input1").on("input", function() {
	var pwd = $(this).val().trim();  
	for (var i = 0, len = pwd.length; i < len; i++) {  
		$input1.eq("" + i + "").val(pwd[i]);  
	};
	$input1.each(function() {  
		var index = $(this).index();  
		if (index >= len) {  
			$(this).val("");  
		};
	});  
	if (len == 6) {
		
	}; 
});
$("#dialog1").on("click",function(){
	$("#dialog1").prop("disabled",true);
	var pwd_input = $("#pwd-input1").val();
	if(!pwd_input){
		closen();
		layer.msg("请输入密码");
		$("#dialog1").prop("disabled",false);
		return false;
	}
	var number = $("#number").html();
	$.ajax({
		type:"post",
		url:url+'/trade/tradebuy.html?token='+token,
		async:true,
		data:{'token':token,"number":number,"jymm":pwd_input},
		dataType:'json',
		success:function(result){
			$("#dialog1").prop("disabled",false);
			closen()
			if(result.status === "0001"){
				layer.msg(result.message)
				window.location.reload()
			}else{
				isErr(result)
			}
		}
	})
})

//卖给他密码输入框
var $input2 = $(".fake-box2 input");  
$("#pwd-input2").on("input", function() {  
	var pwd = $(this).val().trim();  
	for (var i = 0, len = pwd.length; i < len; i++) {  
		$input2.eq("" + i + "").val(pwd[i]);  
	};
	$input2.each(function() {  
		var index = $(this).index();  
		if (index >= len) {  
			$(this).val("");  
		};
	});  
	if (len == 6) {  
		
	};
});
$("#dialog2").on("click",function(){
	$("#dialog2").prop("disabled",true);
	var pwd_input2 = $("#pwd-input2").val();
	if(!pwd_input2){
		closen();
		layer.msg("请输入密码");
		$("#dialog2").prop("disabled",false);
		return false;
	}
	var id = $("#hidden").val();
	$.ajax({
		type:"post",
		url:url+'/trade/tradeorder.html?token='+token,
		async:true,
		data:{'token':token,"id":id,"jymm":pwd_input2},
		dataType:'json',
		success:function(result){
			$("#dialog2").prop("disabled",false);
			// console.log(result)
			closen()
			if(result.status === "0001"){
				layer.msg(result.message)
				window.location.reload()
			}else{
				isErr(result)
			}
		}
	})
})
$(function(){
	//买入数量选择
	$(document).on('click', '.trantop_list .trantop_linkd', function (){
		$(this).children(".trantop_link").addClass("on");
		$(this).siblings(".trantop_linkd").children(".trantop_link").removeClass("on");
		var html = Number($(this).children(".trantop_link").html());
		var number = Number($("#price").html());
		$("#price2").html((html*number).toFixed(4));

	})
	
})

// 清除密码
function closen(){
	dialogClose()
	$(".pwd-input").val("");
	$(".fake-box input").val("")
}
</script>
</html>